/*
 *  $Id: CheckDeckAnswer.cs 1217 2010-11-27 10:48:54Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2010 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using Nereal.Serialization;

namespace Ragima.Events {
    [TypeId("checkdeckanswer"), ConstructorParameters("_check")]
    public class CheckDeckAnswer : DirectConnectEvent {
        [Serialize, XmlName("check")]
        private readonly bool _check;

        public CheckDeckAnswer() {
            _check = false;
        }
        public CheckDeckAnswer(bool check) {
            _check = check;
        }

        protected override void ExecuteInner(DirectConnectScene scene) {
            if (_check) {
                scene.Log.Add(Resources.DirectConnect.CheckDeckComplete);
                scene.Mode.SendEvent(new Deck(scene.Mode.Player1.Deck));
                scene.Mode.AddEvent(new ConnectComplete());
            } else {
                scene.Log.Add(Resources.DirectConnect.CheckDeckError);
                scene.Mode.DisconnectGame();
            }
        }
    }
}
